package main

import (
	"encoding/json"
	"fmt"
	"log"
)

type Server struct {
	ServerName string
	ServerIP   string
}
type Serverslice struct {
	Servers []Server
}

var s Serverslice

func main() {
	str := `{"servers":[{"serverName":"Shanghai_VPN","serverIP":"127.0.0.1"},{"serverName":"Beijing_VPN","serverIP":"127.0.0.2"}]}`
	// Unmarshal 拆解
	err := json.Unmarshal([]byte(str), &s)
	if err != nil {
		log.Fatal("Unmarshal json fail")
	}
	fmt.Println(s)

}
